<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>

<%@ taglib uri="/struts-tags" prefix="s"%>
<%String contextPath = request.getContextPath();%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<%
request.setCharacterEncoding("UTF-8");
%>

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">

<script type="text/javascript">
	function addTypeItem(groupId){
		if(document.getElementById(groupId).value==""){
			alert("添加类别名不能为空.");
			return false;
		}
		var typeName = document.getElementById(groupId).value;
		
		document.forms[0].action = "<%=contextPath%>/typeManage/insterItem.action?group_id="+groupId+"&name="+typeName; 
		document.forms[0].submit();
		
	}
</script>

</head>
<body>
<form method="post" name="from1" id="from1">
<s:iterator id="typeGroup" value="#request.listType" status="status">
	<div style="margin-top: 20px">${typeGroup.name}</div>
	<s:iterator id="typeItem" value="#typeGroup.listItem" status="status">
		<div style="margin-left: 20dp;">${typeItem.name}         删除
		</div>
	</s:iterator>
	<div><input type="text" id="${typeGroup.id}" style="width:200px; height:20px; padding-left:6px; font-size:12px"></input>
		<button onclick="addTypeItem(${typeGroup.id})">添加类别</button>
	</div>
</s:iterator>


</form>


</body>
</html>

